/*This do-file replicates results presented in Christian A. Vossler, Michael McKee, and David M. Bruner,  
"Behavioral effects of tax withholding on tax compliance: Implications for information initiatives" */

*The name of the public use data file is "VMB Replication data.dta"
*Two-way fixed effects models use the "reghdfe" command. For installation information, go to http://scorreia.com/software/reghdfe/
*For questions, contact Christian Vossler (cvossler@utk.edu)


// Summary stats (Table 6)
sum TaxReported LiabilityService TaxWithheld ExpectedLiability TaxUnderwithheld TaxOverwithheld Underwithheld Overwithheld Compliance Fairness ///
EarnedIncome HighStandard Itemized AuditRate LiabilityServiceNot SocialInteractions ///
TaxUnderwithheldInfo TaxOverwithheldInfo ComplianceInfo EarnedIncomeInfo ItemizedInfo ///
LiabilityServiceAvailable ComplianceWH EarnedIncomeWH HighItemized Audited UnexpectedTaxIncrease UnexpectedTaxDecrease ///
RiskAverse EmployedFulltime Female Age CollegeDegree UT TotalIncome NonmatchedIncome AskedForAdvice UsedPrepService ReportedTaxesOwed FiledJointly ItemizedDeductions 


// TAX REPORTING MODELS (Table 7)

// define covariates
global Invariant LiabilityServiceNot SocialInteractions RiskAverse EmployedFulltime Female Age CollegeDegree UT TotalIncome NonmatchedIncome AskedForAdvice UsedPrepService ReportedTaxesOwed FiledJointly ItemizedDeductions 
global Model1 TaxWithheld LiabilityService Compliance Fairness EarnedIncome HighStandard Itemized AuditRate 
global Model2 TaxUnderwithheld TaxOverwithheld LiabilityService Compliance Fairness EarnedIncome HighStandard Itemized AuditRate 
global Model3 TaxUnderwithheld TaxOverwithheld 1.LiabilityService 1.LiabilityService#(1.Underwithheld) Compliance c.Compliance#1.Underwithheld Fairness c.Fairness#(1.Underwithheld) 1.LiabilityService#1.SocialInteractions EarnedIncome HighStandard Itemized AuditRate 


// Model 1: basic treatment effects model
reghdfe TaxReported $Model1, absorb(SubjectID Round) cluster(SubjectID)
// second stage regression using estimated subject fixed effects
quietly {
regress TaxReported $Model1 i.SubjectID i.Round, cluster(SubjectID)
gen FE=0 
local i = 2
while `i'<=359 {
replace FE = _b[`i'.SubjectID] if SubjectID==`i'
local i=`i'+1 
}
}
regress FE $Invariant  if Round==1, robust
drop FE


// Model 2: allow for under/over WH effects
reghdfe TaxReported $Model2, absorb(SubjectID Round) cluster(SubjectID)
// second stage regression using estimated subject fixed effects
quietly {
regress TaxReported $Model2 i.SubjectID i.Round, cluster(SubjectID)
gen FE=0 
local i = 2
while `i'<=359 {
replace FE = _b[`i'.SubjectID] if SubjectID==`i'
local i=`i'+1 
}
}
regress FE $Invariant  if Round==1, robust
drop FE


// Model 3: allow for under/over WH effects, info service interaction effects
reghdfe TaxReported $Model3, absorb(SubjectID Round) cluster(SubjectID)
lincom 1.LiabilityService + 1.LiabilityService#1.SocialInteractions

// second stage regression using estimated subject fixed effects
quietly {
regress TaxReported $Model3 i.SubjectID i.Round, cluster(SubjectID)
gen FE=0 
local i = 2
while `i'<=359 {
replace FE = _b[`i'.SubjectID] if SubjectID==`i'
local i=`i'+1 
}
}
regress FE $Invariant  if Round==1, robust
drop FE


// LIABILITY SERVICE PURCHASE REGRESSIONS (Table 8)

// define covariates
global InvariantLS SocialInteractions RiskAverse EmployedFulltime Female Age CollegeDegree UT TotalIncome NonmatchedIncome AskedForAdvice UsedPrepService ReportedTaxesOwed FiledJointly ItemizedDeductions 
global Model4 TaxWithheld_s Compliance_s Fairness_s EarnedIncome_s HighStandard Itemized_s AuditRate 
global Model5 TaxUnderwithheld_s TaxOverwithheld_s Compliance_s Fairness_s EarnedIncome_s HighStandard Itemized_s AuditRate 


/* Model 4: T3&T4 sample; dv is information acquisition (yes/no) */
reghdfe LiabilityService $Model4 if File==1, absorb(SubjectID Round) cluster(SubjectID)
// second stage regression using estimated subject fixed effects
quietly {
regress LiabilityService $Model4 ib185.SubjectID i.Round if File==1, cluster(SubjectID)
gen FE=0 
local i = 185+1
while `i'<=359 {
replace FE = _b[`i'.SubjectID] if SubjectID==`i'
local i=`i'+1 
}
}
regress FE $InvariantLS if Round==1 & LiabilityServiceAvailable==1, robust
drop FE  


/* Model 5: T3&T4 sample; dv is information acquisition (yes/no) */
reghdfe LiabilityService $Model5 if File==1, absorb(SubjectID) cluster(SubjectID)
// second stage regression using estimated subject fixed effects
quietly {
regress LiabilityService $Model5 ib185.SubjectID i.Round if File==1, cluster(SubjectID)
gen FE=0 
local i = 185+1
while `i'<=359 {
replace FE = _b[`i'.SubjectID] if SubjectID==`i'
local i=`i'+1 
}
}
regress FE $InvariantLS if Round==1 & LiabilityServiceAvailable==1, robust
drop FE  



// TAX WITHHOLDING MODELS (Table 9)

global Xwithhold ComplianceWH Fairness EarnedIncomeWH HighItemized AuditRate Audited
global InvariantWH LiabilityServiceAvailable SocialInteractions RiskAverse EmployedFulltime Female Age CollegeDegree UT TotalIncome NonmatchedIncome AskedForAdvice UsedPrepService ReportedTaxesOwed FiledJointly ItemizedDeductions  

// Model 6: withholding choice
reghdfe TaxWithheld $Xwithhold, absorb(SubjectID Round) cluster(SubjectID)
// second stage regression using estimated subject fixed effects
quietly {
regress TaxWithheld $Xwithhold i.SubjectID i.Round, cluster(SubjectID)
gen FE=0 
local i = 2
while `i'<=359 {
replace FE = _b[`i'.SubjectID] if SubjectID==`i'
local i=`i'+1 
}
}
regress FE $InvariantWH if Round==1, robust
drop FE


// Figure 1. scatter plot, individual-level data, underreporting relative to tax withholding
twoway (scatter m_TaxReported m_TaxUnderwithheld) (lfit m_TaxReported m_TaxUnderwithheld) if Round==1, ytitle("Tax Reported") xtitle("Tax Under-withheld") leg(off)
twoway (scatter m_TaxReported m_TaxOverwithheld) (lfit m_TaxReported m_TaxOverwithheld) if Round==1,  ytitle("Tax Reported") xtitle("Tax Over-withheld") leg(off)


// Some additional stats reported in paper

sum ActualLiability TaxReported
sum TaxOverwithheld TaxReported ActualLiability if TaxOverwithheld>0
sum TaxUnderwithheld TaxReported ActualLiability if TaxUnderwithheld>0
sum TaxReported if LiabilityService==1
sum TaxReported if LiabilityService==0 & LiabilityServiceAvailable==1



